Repository navigation
fix(daemon): enforce the source-install request deadline - #4727
Conversation
…ne at the descriptor/router path Give install-from-source and install_source one shared source-install timeout policy (#4441, decisions 6856998913/6827686874): the existing 600000ms client envelope with a 570000ms daemonDeadlineMs derived from the 30000ms result margin. resolveDaemonRequestTimeoutMs now returns 570000 for both commands, so the request router wraps their execution in the existing withRequestDeadline owner instead of running source installs under the client envelope alone. withRequestDeadline now honors any earlier registered execution/result deadline at admission and refuses task entry when the earliest registered cutoff has already passed, while leaving mid-task execution enforcement, callback cancellation, unrelated command policies and the native-install caps untouched. A request without transport metadata still gets the finite 570000ms budget from its descriptor. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
… daemon deadline (#4441) Loopback HTTP/RPC ingress feeding the real request router and the normal provider-backed source-install path (only the provider gateway seam is faked), under controlled clocks. Proves on top of the descriptor candidate: the 570s daemon deadline expiring at exactly admission+570000ms with a typed daemon_request_timeout error and no success on the wire; work crossing the cutoff mid-task aborted with artifact cleanup; the streaming route answering the typed error in-stream after response headers were already sent, with the request lifetime released; task entry refused when an earlier registered result deadline already passed, while a live earlier deadline is the effective cutoff an admitted request observes; plus an ordinary benign success control. Detection: 6/6 pass on the candidate; on clean origin/main 6e18ea3 and on a deadline-removal mutation of the candidate, the four detecting cases fail (daemon never answers within the 570s budget; entry not refused). Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Size Report
Startup median (7 runs, lower is better):
|
This comment has been minimized.
This comment has been minimized.
|
Reviewed aa4f988. The change needs one rework before merge: the new deadline helper duplicates an existing rule and leaves a gap in the request deadline. All 18 checks are green at this commit, and I know of no conflicts.
The same fix closes a gap. The test a live earlier result deadline is the effective cutoff only checks that Not blocking, take or leave: No device run is needed here. The combined proxy to daemon to downloader path stays with #4441. |
|
Addressed the review of aa4f988 in The router test keeps materialization pending, advances the clock past the earlier cutoff, and asserts All 69 focused tests, lint, and typecheck passed. Exact affected validation and hosted CI are running. I moved the registry comment and kept the real-clock RPC fixture for the fake-clock route tests. |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 3 new findings on 5fb8c9e. The verdict and the full list are in the summary comment.
|
Addressed the three follow-up findings in
All 161 focused tests, lint, and typecheck passed. Exact affected validation and hosted CI are running. |
Apex Sentinel · ✅ Approve · review of
|
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
|
I reviewed 8b3511b against my earlier findings at aa4f988 (#4727 (comment)). The code looks right and I have no blocking findings. The earlier findings are fixed: top-level Not blocking, and you can take or leave these: lease-context.ts:36 still infers a bounded batch/replay step from the presence of any execution deadline, so the next command with a Could On the earlier inline threads: the thread on the install-source admission route (#4727 (comment)), the one on the batch/replay budget split (#4727 (comment)) and the one on the reported deadline value (#4727 (comment)) are all fixed at this head, so please resolve them. No other threads remain open that still apply. Nothing blocks merge. The only open item is the design question above, which you can answer or take. |
|
The markers are the right source for identifying ordinary composite steps. There is one bypass to account for before changing the predicate globally. A replay test can run as a bounded batch step. Its suite-owned cleanup calls I corrected the PR description to say that the existing 60-second batch and replay budgets can be capped by the transport-admission deadline. GitHub shows all three earlier threads resolved and all 17 checks passed at |
…base Stacked on #4727 (5fb8c9e) so the install_source daemon deadline is armed at admission on both daemon entry transports (HTTP /rpc and the newline socket). Implements the two blocking findings from the #4726 review (issuecomment-7003528891): - f1: the install_source handler now derives the materialization cutoff from getRequestDeadlineMs(requestId) minus the deploy-ledger reserve (INSTALL_SOURCE_DEPLOY_LEDGER_RESERVE_MS = 480s envelope - 30s margin = 450s, the install-route worst-case ledger) via the new getRequestBudgetSignal owner in host-kit request-cancel, which composes the request's shared cancellation with the remaining-deadline timeout (AbortSignal.any) instead of arming an independent maximum. The signal travels through MaterializeAppSourceInput.signal into the Android and Apple prepareArtifact paths, so the armed cutoff reaches materializeInstallablePath on both transports (proven by loopback router tests over HTTP RPC and socket). The standalone 600s aggregate stays as the fallback when no daemon deadline is armed, and the native phase/install caps are untouched. The install ledger test sums the download call again: on daemon routes the download timer is the derived remaining budget (<= 570s-450s), so a 600s value fails the 600s envelope sum (red-verified against the pre-fix handler, which records 600000ms and fails all five install_source URL cases). - f2: the response-header phase now arms when the upstream connection is established on every dispatcher the transport builds. Pinned undici 7.30.1 (pnpm-lock) ProxyAgent never emits 'connect' (verified in lib/dispatcher/proxy-agent.js: it builds its own inner Agent), so the proxy path wraps the tunnel connector handed to the inner factory and fires onConnected when the CONNECT tunnel succeeds; the direct Agent keeps the 'connect' event. New benign owned loopback CONNECT proxy tests prove headers get their own 30s phase budget (headers at 35s succeed past the old 30s connect budget) and that stalled headers expire with the typed transfer_phase_timeout 'response-headers' result; both fail against the pre-fix transport. Also resolves the take-or-leave items: the install-source doc names the real deadline carrier, and classifyMaterializationError only relabels abort-shaped errors (error === signal.reason or error.cause === signal.reason) so a typed failure racing an abort keeps its identity. Refs #4441 (decisions 6827686874/6856998913), #4726, #4727. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
|
Thanks, that settles it. The suite-owned cleanup reaches the close handlers without either marker, so a marker-only predicate would stop treating that cleanup as bounded. Keeping the predicate as-is in this deadline fix is right, and carrying trusted composite provenance for cleanup can be a follow-up. With the body corrected and the threads resolved, this is ready for a maintainer to merge. |
* feat(provision-kit): propagate source-install deadlines into download phases Align the provision-kit source-install/download path with the adopted #4441 policy (Decisions 6827686874/6876352959): - Remove the contradictory fixed 120s source-transfer signal. The shared budget from admission (request signal) now governs download and extraction; a standalone materialization call gets a finite 600s aggregate at entry, combined with caller cancellation, so the API never becomes unbounded. - Drive the download through the existing host-kit transfer phase watchdog: 30s connect, 30s response-header wait after connection establishment, 120s accepted-byte inactivity. Redirect hops rearm fresh phase timers on the same aggregate signal. - Wire the watchdog signal into the response-body pipeline and count accepted body bytes as the only progress that rearms the inactivity ceiling. - Preserve the typed first failure: caller cancellation stays typed cancellation, phase timeouts keep their phase and budget, aggregate expiry reports source_materialization_deadline_exceeded. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai> * fix(provision-kit): preserve source deadline failures before publication * fix(provision-kit): retain hop timeout causes and verify standalone budget * fix(provision-kit,daemon): resolve #4726 review findings on the 570s base Stacked on #4727 (5fb8c9e) so the install_source daemon deadline is armed at admission on both daemon entry transports (HTTP /rpc and the newline socket). Implements the two blocking findings from the #4726 review (issuecomment-7003528891): - f1: the install_source handler now derives the materialization cutoff from getRequestDeadlineMs(requestId) minus the deploy-ledger reserve (INSTALL_SOURCE_DEPLOY_LEDGER_RESERVE_MS = 480s envelope - 30s margin = 450s, the install-route worst-case ledger) via the new getRequestBudgetSignal owner in host-kit request-cancel, which composes the request's shared cancellation with the remaining-deadline timeout (AbortSignal.any) instead of arming an independent maximum. The signal travels through MaterializeAppSourceInput.signal into the Android and Apple prepareArtifact paths, so the armed cutoff reaches materializeInstallablePath on both transports (proven by loopback router tests over HTTP RPC and socket). The standalone 600s aggregate stays as the fallback when no daemon deadline is armed, and the native phase/install caps are untouched. The install ledger test sums the download call again: on daemon routes the download timer is the derived remaining budget (<= 570s-450s), so a 600s value fails the 600s envelope sum (red-verified against the pre-fix handler, which records 600000ms and fails all five install_source URL cases). - f2: the response-header phase now arms when the upstream connection is established on every dispatcher the transport builds. Pinned undici 7.30.1 (pnpm-lock) ProxyAgent never emits 'connect' (verified in lib/dispatcher/proxy-agent.js: it builds its own inner Agent), so the proxy path wraps the tunnel connector handed to the inner factory and fires onConnected when the CONNECT tunnel succeeds; the direct Agent keeps the 'connect' event. New benign owned loopback CONNECT proxy tests prove headers get their own 30s phase budget (headers at 35s succeed past the old 30s connect budget) and that stalled headers expire with the typed transfer_phase_timeout 'response-headers' result; both fail against the pre-fix transport. Also resolves the take-or-leave items: the install-source doc names the real deadline carrier, and classifyMaterializationError only relabels abort-shaped errors (error === signal.reason or error.cause === signal.reason) so a typed failure racing an abort keeps its identity. Refs #4441 (decisions 6827686874/6856998913), #4726, #4727. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai> * fix(providers): forward the daemon-derived materialization cutoff through Webdriver and Revyl bindings The daemon derives the URL materialization cutoff from the earliest registered request deadline less the deploy-ledger reserve and passes it through MaterializeAppSourceInput.signal. The Webdriver and Revyl bindings dropped it and used only the binding scope signal, so a hosted download could run to the full request deadline and starve the deploy ledger. Forward the input cutoff where present and keep the scope signal as the fallback, matching the platform deployment bindings (#4441, #4726). * test(provision-kit): prove the install ledger splits readiness from the deploy reserve WIP: the 450s deploy-ledger reserve is the whole install ledger including readiness, but the daemon derives the materialization cutoff after ensureReady has run, so readiness is charged twice. A cold boot of 120s or more arms a zero-second cutoff and the URL install fails before a byte is fetched. The recorded per-phase sums show the deploy-only worst case is 320s. * fix(provision-kit): carry the materialization cutoff as deadline data and split the ledger reserve The cutoff now travels as materializationDeadlineMs on MaterializeAppSourceInput. The materializer arms one timer at min(600s aggregate, remaining) and every timer-driven abort reports source_materialization_deadline_exceeded with the timeout actually armed; only a real request cancellation reports request_canceled. This deletes getRequestBudgetSignal and the four input.signal ?? signal forwards (platform, Webdriver, and Revyl bindings): the bindings forward the input untouched and keep their scope signal for cancellation, so no provider carries deadline code. The reserve becomes the deploy ledger's worst case without readiness (320s), with the readiness share named as INSTALL_SOURCE_READINESS_WORST_CASE_MS (150s). The cutoff is derived after ensureReady, so charging readiness to the reserve twice armed a zero-second cutoff on a cold-boot route (#4726). * fix(command-registry): keep the readiness worst case in the ledger test --------- Co-authored-by: Mistral Vibe <vibe@mistral.ai>
Summary
Enforce a 570-second daemon deadline for source installs inside the existing 600-second client envelope. An earlier registered result deadline can refuse entry or abort in-flight source work. Timeout details report the effective budget. Ordinary source installs retain their lease admission behavior, and batch and replay retain their 60-second budget. For HTTP or socket requests with a registered result deadline, their timer is capped by the earlier deadline measured from transport admission.
Refs #4441. The downloader and materialization budget are covered separately in #4726.
Validation
Head
8b3511b5dd1503a3b1b7f7b8dbfa36d8795379e7.daemon_request_timeoutresponse and the effective budget.8b3511bwith zero open findings. All three inline threads from5fb8c9eare resolved.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.